package com.zeratul.common.core.filter;

import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.filter.TypeFilter;

import java.io.IOException;

/**
 * Spring扫描过滤器，排除掉common包下的自动扫描
 */
public class CommonPackageFilter implements TypeFilter {
    @Override
    public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory) throws IOException {
        String className = metadataReader.getClassMetadata().getClassName();
        // 排除所有在common包下的类
        return className.startsWith("com.zeratul.common");
    }
}
